//
//  IconCategory.swift
//  Accounting
//
//  Created by Qingke on 16/5/10.
//  Copyright © 2016年 Qingke. All rights reserved.
//

import UIKit

class IconCategory: NSObject,NSCoding {
    
    var customIcon: UIImage?
    var customMark: String = ""
    var customDate = ""
    var customAddMoney = 0.00
    
    let categoryIconKey = "categoryIconKey"
    let customMarkKey = "customMarkKey"
    let customDateKey = "customDateKey"
    let customAddMoneyKey = "customAddMoneyKey"
    
    override init() {
        super.init()
    }
    func encodeWithCoder(aCoder: NSCoder) {
        aCoder.encodeObject(customMark, forKey: customMarkKey)
        aCoder.encodeObject(customIcon, forKey: categoryIconKey)
        aCoder.encodeObject(customDate, forKey: customDateKey)
        aCoder.encodeDouble(customAddMoney, forKey: customAddMoneyKey)
    }
    required init?(coder aDecoder: NSCoder) {
        self.customIcon = aDecoder.decodeObjectForKey(categoryIconKey) as? UIImage
        self.customMark = aDecoder.decodeObjectForKey(customMark) as? String ?? ""
        self.customDate = aDecoder.decodeObjectForKey(customDateKey) as? String ?? ""
        self.customAddMoney = aDecoder.decodeDoubleForKey(customAddMoneyKey)
        
        super.init()
    }
}
